﻿package ui{
	import sample.ui.components.*
	import playerio.*
	import flash.text.TextFormatAlign
	public class RoomEntry extends Box{
		function RoomEntry(room:RoomInfo, joinHandler:Function){
			super();
			margin(1,1,1,1).minSize(40,35).add(
				new Box().margin(0,0,0,0).fill(0xEEEEEE,.2,10).border(1,0xBBBBBB,1).add(
					new Box().margin(NaN,NaN,NaN,5).add(new Label(room.data.name))
				).add(
					new Box().margin(3,3,3).add(
						new Box().margin(0,0,0,0).minSize(200,0).add(
							new Columns(
								new Box().margin(5,0,0,0).add(new Label(room.onlineUsers.toString() + " players",12, TextFormatAlign.CENTER )),
								new TextButton("Join Game", function(){  joinHandler(room.id) })
							)
						)
					)
				)
			)
		}
	}
}